<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<link rel="stylesheet" type="text/css" media="screen" href="../../css/bootstrap.min.css">
</head>
<body>
<div class="col-xs-12 col-sm-12 col-md-12 col-lg-12">
	<form class="form-horizontal" onsubmit="return false" id="form">
		<fieldset>
			<input type="hidden" id="id" name="id">
			<div class='form-group'>
				<label class='col-md-2 control-label'>visitdetailid</label>
				<div class='col-md-10'>
					<input class='form-control' placeholder='visitdetailid' type='text' name='visitdetailid' id='visitdetailid' data-bv-notempty='true' data-bv-notempty-message='visitdetailid 不能为空'>
				</div>
			</div>
			<div class='form-group'>
				<label class='col-md-2 control-label'>hostcode</label>
				<div class='col-md-10'>
					<input class='form-control' placeholder='hostcode' type='text' name='hostcode' id='hostcode' data-bv-notempty='true' data-bv-notempty-message='hostcode 不能为空'>
				</div>
			</div>
			<div class='form-group'>
				<label class='col-md-2 control-label'>visitdate</label>
				<div class='col-md-10'>
					<input class='form-control' placeholder='visitdate' type='text' name='visitdate' id='visitdate' data-bv-notempty='true' data-bv-notempty-message='visitdate 不能为空'>
				</div>
			</div>
			<div class='form-group'>
				<label class='col-md-2 control-label'>visitno</label>
				<div class='col-md-10'>
					<input class='form-control' placeholder='visitno' type='text' name='visitno' id='visitno' data-bv-notempty='true' data-bv-notempty-message='visitno 不能为空'>
				</div>
			</div>
			<div class='form-group'>
				<label class='col-md-2 control-label'>patientid</label>
				<div class='col-md-10'>
					<input class='form-control' placeholder='patientid' type='text' name='patientid' id='patientid' data-bv-notempty='true' data-bv-notempty-message='patientid 不能为空'>
				</div>
			</div>
			<div class='form-group'>
				<label class='col-md-2 control-label'>cliniclabel</label>
				<div class='col-md-10'>
					<input class='form-control' placeholder='cliniclabel' type='text' name='cliniclabel' id='cliniclabel' data-bv-notempty='true' data-bv-notempty-message='cliniclabel 不能为空'>
				</div>
			</div>
			<div class='form-group'>
				<label class='col-md-2 control-label'>patientname</label>
				<div class='col-md-10'>
					<input class='form-control' placeholder='patientname' type='text' name='patientname' id='patientname' data-bv-notempty='true' data-bv-notempty-message='patientname 不能为空'>
				</div>
			</div>
			<div class='form-group'>
				<label class='col-md-2 control-label'>clinictype</label>
				<div class='col-md-10'>
					<input class='form-control' placeholder='clinictype' type='text' name='clinictype' id='clinictype' data-bv-notempty='true' data-bv-notempty-message='clinictype 不能为空'>
				</div>
			</div>
			<div class='form-group'>
				<label class='col-md-2 control-label'>sumfee</label>
				<div class='col-md-10'>
					<input class='form-control' placeholder='sumfee' type='text' name='sumfee' id='sumfee' data-bv-notempty='true' data-bv-notempty-message='sumfee 不能为空'>
				</div>
			</div>
			<div class='form-group'>
				<label class='col-md-2 control-label'>receiptno</label>
				<div class='col-md-10'>
					<input class='form-control' placeholder='receiptno' type='text' name='receiptno' id='receiptno' data-bv-notempty='true' data-bv-notempty-message='receiptno 不能为空'>
				</div>
			</div>
			<div class='form-group'>
				<label class='col-md-2 control-label'>visitstatus</label>
				<div class='col-md-10'>
					<input class='form-control' placeholder='visitstatus' type='text' name='visitstatus' id='visitstatus' data-bv-notempty='true' data-bv-notempty-message='visitstatus 不能为空'>
				</div>
			</div>
			<div class='form-group'>
				<label class='col-md-2 control-label'>phone</label>
				<div class='col-md-10'>
					<input class='form-control' placeholder='phone' type='text' name='phone' id='phone' data-bv-notempty='true' data-bv-notempty-message='phone 不能为空'>
				</div>
			</div>
			<div class='form-group'>
				<label class='col-md-2 control-label'>idno</label>
				<div class='col-md-10'>
					<input class='form-control' placeholder='idno' type='text' name='idno' id='idno' data-bv-notempty='true' data-bv-notempty-message='idno 不能为空'>
				</div>
			</div>
			<div class='form-group'>
				<label class='col-md-2 control-label'>deptcode</label>
				<div class='col-md-10'>
					<input class='form-control' placeholder='deptcode' type='text' name='deptcode' id='deptcode' data-bv-notempty='true' data-bv-notempty-message='deptcode 不能为空'>
				</div>
			</div>
			<div class='form-group'>
				<label class='col-md-2 control-label'>deptname</label>
				<div class='col-md-10'>
					<input class='form-control' placeholder='deptname' type='text' name='deptname' id='deptname' data-bv-notempty='true' data-bv-notempty-message='deptname 不能为空'>
				</div>
			</div>
			<div class='form-group'>
				<label class='col-md-2 control-label'>doctorcode</label>
				<div class='col-md-10'>
					<input class='form-control' placeholder='doctorcode' type='text' name='doctorcode' id='doctorcode' data-bv-notempty='true' data-bv-notempty-message='doctorcode 不能为空'>
				</div>
			</div>
			<div class='form-group'>
				<label class='col-md-2 control-label'>doctorname</label>
				<div class='col-md-10'>
					<input class='form-control' placeholder='doctorname' type='text' name='doctorname' id='doctorname' data-bv-notempty='true' data-bv-notempty-message='doctorname 不能为空'>
				</div>
			</div>
			<div class='form-group'>
				<label class='col-md-2 control-label'>cardtype</label>
				<div class='col-md-10'>
					<input class='form-control' placeholder='cardtype' type='text' name='cardtype' id='cardtype' data-bv-notempty='true' data-bv-notempty-message='cardtype 不能为空'>
				</div>
			</div>
			<div class='form-group'>
				<label class='col-md-2 control-label'>cardno</label>
				<div class='col-md-10'>
					<input class='form-control' placeholder='cardno' type='text' name='cardno' id='cardno' data-bv-notempty='true' data-bv-notempty-message='cardno 不能为空'>
				</div>
			</div>
			<div class='form-group'>
				<label class='col-md-2 control-label'>selfdescribe</label>
				<div class='col-md-10'>
					<input class='form-control' placeholder='selfdescribe' type='text' name='selfdescribe' id='selfdescribe' data-bv-notempty='true' data-bv-notempty-message='selfdescribe 不能为空'>
				</div>
			</div>
			<div class='form-group'>
				<label class='col-md-2 control-label'>diageresult</label>
				<div class='col-md-10'>
					<input class='form-control' placeholder='diageresult' type='text' name='diageresult' id='diageresult' data-bv-notempty='true' data-bv-notempty-message='diageresult 不能为空'>
				</div>
			</div>
			<div class='form-group'>
				<label class='col-md-2 control-label'>icdcode</label>
				<div class='col-md-10'>
					<input class='form-control' placeholder='icdcode' type='text' name='icdcode' id='icdcode' data-bv-notempty='true' data-bv-notempty-message='icdcode 不能为空'>
				</div>
			</div>
			<div class='form-group'>
				<label class='col-md-2 control-label'>diagdescribe</label>
				<div class='col-md-10'>
					<input class='form-control' placeholder='diagdescribe' type='text' name='diagdescribe' id='diagdescribe' data-bv-notempty='true' data-bv-notempty-message='diagdescribe 不能为空'>
				</div>
			</div>



			<div class="form-actions">
				<div class="row" align="center">
					<div class="col-md-12">
					    <button class="btn btn-primary" onclick="location.href='appVisitDetailList.html'">返回</button>
						<button class="btn btn-primary" type="submit" onclick="update()">
							<i class="fa fa-save"></i> 保存
						</button>
					</div>
				</div>
			</div>

		</fieldset>
	</form>
</div>
	<script type="text/javascript" src="../../js/libs/jquery-2.1.1.min.js"></script>
	<script type="text/javascript" src="../../js/jq.js"></script>
	<script type="text/javascript" src="../../js/plugin/bootstrapvalidator/bootstrapValidator.min.js"></script>
	<script type="text/javascript" src="../../js/common.js"></script>
	<script type="text/javascript" src="../../layui/layui.js"></script>
	<script type="text/javascript">
		layui.use(['layer','laydate'], function(){
		    var layer = layui.layer;
		});
		
		initData();
		
		function initData(){
			var id = getUrlParam("id");
			if(id != ""){
				$.ajax({
					type : 'get',
					url : '/appVisitDetails/'+id,
					async : false,
					success : function(data) {
						$('#id').val(data.id);
						$('#visitdetailid').val(data.visitdetailid);
						$('#hostcode').val(data.hostcode);
						$('#visitdate').val(data.visitdate);
						$('#visitno').val(data.visitno);
						$('#patientid').val(data.patientid);
						$('#cliniclabel').val(data.cliniclabel);
						$('#patientname').val(data.patientname);
						$('#clinictype').val(data.clinictype);
						$('#sumfee').val(data.sumfee);
						$('#receiptno').val(data.receiptno);
						$('#visitstatus').val(data.visitstatus);
						$('#phone').val(data.phone);
						$('#idno').val(data.idno);
						$('#deptcode').val(data.deptcode);
						$('#deptname').val(data.deptname);
						$('#doctorcode').val(data.doctorcode);
						$('#doctorname').val(data.doctorname);
						$('#cardtype').val(data.cardtype);
						$('#cardno').val(data.cardno);
						$('#selfdescribe').val(data.selfdescribe);
						$('#diageresult').val(data.diageresult);
						$('#icdcode').val(data.icdcode);
						$('#diagdescribe').val(data.diagdescribe);

					}
				});
			}
		}

		function update() {
			$('#form').bootstrapValidator();
			var bootstrapValidator = $("#form").data('bootstrapValidator');
			bootstrapValidator.validate();
		    if(!bootstrapValidator.isValid()){
			   return;
		    }
		    
		    var formdata = $("#form").serializeObject();

			$.ajax({
				type : 'put',
				url : '/appVisitDetails',
				contentType: "application/json; charset=utf-8",  
				data : JSON.stringify(formdata),
				success : function(data) {
					layer.msg("修改成功", {shift: -1, time: 1000}, function(){
                        location.href = "appVisitDetailList.html";
                    });
				}
			});
		}
		
	</script>
</body>
</html>
